package com.shopAttr.controller;


import com.shopAttr.bean.ShopAttr;
import com.shopAttr.service.IShopAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import shopBean.common.bean.RestResult;
import shopBean.common.utils.RestResultGenerator;

import java.util.List;

@RestController
@RequestMapping("/shopattr/")
public class ShopAttrController {

    @Autowired
    public IShopAttrService shopAttrService;



    @RequestMapping("/insert.api")
    public RestResult<ShopAttr> insert(@RequestBody ShopAttr shopAttr){

        return this.shopAttrService.insert(shopAttr);
    }

    @RequestMapping("/deleteById.api")
    public RestResult deleteById(String id){

        return RestResultGenerator.genSuccessResult(this.shopAttrService.deleteById(id));
    }
    @RequestMapping("/update.api")
    public RestResult update(@RequestBody ShopAttr shopAttr){

        return RestResultGenerator.genSuccessResult(this.shopAttrService.update(shopAttr));
    }
    @RequestMapping("/getByPid.api")
    public RestResult<List<ShopAttr>> getByPid( String id){

        return RestResultGenerator.genSuccessResult(this.shopAttrService.getByPid(id));
    }
    @RequestMapping("/getFristByShopId.api")
    public RestResult<List<ShopAttr>> getFristByShopId(String shopId){

        return RestResultGenerator.genSuccessResult(this.shopAttrService.getFristByShopId(shopId));
    }

    @RequestMapping("/getByShopId.api")
    public RestResult<List<ShopAttr>> getByShopId(String shopId){

        return RestResultGenerator.genSuccessResult(this.shopAttrService.getByShopId(shopId));
    }
}
